<?php

class Home_model extends CI_Model {

    protected $hr = null;

    public function __construct() {
        parent::__construct();
        $this->hr = $this->load->database("hr", TRUE);
    }

    public function wf_course($where = array(), $return = 0) { // หลักสูตรที่เปิด : object
        $this->hr->select('CO_RUNNO,CO_CODE,CO_TNAME,CO_CANCEL,CT_CODE');
        $this->hr->from('WF_COURSE (nolock)');
        $this->hr->where('CO_CANCEL', 'N');
        if (!empty($where)) {
            $this->hr->where($where);
        }
        $qeury = $this->hr->get();
        if ($qeury->num_rows()) {
            return ($return == 1) ? $qeury->result() : $qeury->row();
        } else {
            return array();
        }
    }

}

?>